package models

import (
	"gopkg.in/mgo.v2/bson"
)

type IComment interface {
	AddComment(comment Comment) error
	DelComment(id bson.ObjectId) error
	ModifyComment(id bson.ObjectId, words string) error
	VoteComment(id bson.ObjectId) error
	PraiseComment(id bson.ObjectId) error
	UndopraiseComment(id bson.ObjectId) error
	GetCommentsById(id bson.ObjectId, commentType, limit int, ts int64, op string, obj interface{}) error
	GetCommentsByQid(qid string, obj interface{}) error
	ShieldComment(id bson.ObjectId, reasons []string) error
}

type CommentProfile struct {
	Id          bson.ObjectId `bson:"_id" json:"commentId" valid:"Required"`
	Words       string        `bson:"words" json:"words" valid:"Required"`
	Commentator User          `bson:"commentator" json:"commentator" valid:"Required"`
}

type Comment struct {
	Id          bson.ObjectId `bson:"_id" json:"commentId" valid:"Required"`
	ContentId   string        `bson:"contentId" json:"contentId" valid:"Required"`
	Words       string        `bson:"words" json:"words" valid:"Required"`
	Vote        int64         `bson:"vote" json:"vote" valid:"Required"`
	Commentator User          `bson:"commentator" json:"commentator" valid:"Required"`
	Shield      Shield        `bson:"shield" json:"shield" valid:"Required"`
	Type        int           `bson:"type" json:"type" valid:"Required"`
	Created     int64         `bson:"created" json:"created" valid:"Required"`
}

type PraisedComment struct {
	Id      bson.ObjectId `bson:"_id" json:"commentId" valid:"Required"`
	qid     string        `bson:"qid" json:"qid" valid:"Required"`
	Comment Comment       `bson:"comment" json:"comment" valid:"Required"`
	Created int64         `bson:"created" json:"created" valid:"Required"`
}
